<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'', styles:'bootstrap,font-awesome,animate,style,bootstrap-table,layui-date,auto-complete,dtvalidate,layui'}){%>
    <style type="text/css">
        body{padding-top:10px;}
        *{margin:0;padding:0;list-style-type:none;}
        a,img{border:0;}
        .demo h2{font-size:16px;color:#3366cc;height:30px;}
        .demo li{float:left;}
    </style>
    <%}%>
</head>

<body>

<div class="wrapper wrapper-content">
    <!-- START 数据表格 -->
    <table id="portTable"
           data-toolbar="#toolbar"
           data-side-pagination="server"
           data-pagination="true"
           data-resizable="true"
           data-url="/sea/finance/fundType/findByShop.do"
           data-page-size="15"
           class="table table-striped table-hover"
    >
    </table>
    <!-- END 数据表格 -->
</div>

<%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,bootstrap-table,dtvalidate,dtvalidate-lang-zh_cn,bootstrap-table-zh-CN,laydate,layer'}){}%>
<script>
    var $portTable = $('#portTable');
    $(function(){

        //START 表格配置
        $portTable.bootstrapTable({
            pageSize:10,
            detailView: true,
            columns: [
                {
                    title: '主体',
                    field: 'fundShop',
                    align: 'center',
                    valign: 'middle'
                }
            ],
            onLoadSuccess : function(){

            },
            onExpandRow: function (index, row, $detail) {
                InitSubTable(index, row, $detail);
            }
        });
        //END 表格配置
    });

    var cur_table;
    var fundShop;
    //初始化子表格(无线循环)
    function InitSubTable (index, row, $detail) {
        fundShop = row.fundShop;
        cur_table = $detail.html('<table id="child_table" class="table table-striped table-hover"></table>').find('table');
        $(cur_table).bootstrapTable({
            url: '/sea/finance/fundType/findByMoneyType',
            method: 'get',
            clickToSelect: true,
            queryParams: { fundShop: fundShop },
            ajaxOptions: { fundShop: fundShop },
            //height: 500,
            uniqueId: "id",
            pageSize: 10,
            pageList: [10, 25],
            detailView: true,
            columns: [
                {
                    field: 'fundMoneyType',
                    title: '币种',
                    align: 'center'
                },{
                    field: 'fundTotal',
                    title: '余额',
                    align: 'center'
                }],
            onLoadSuccess : function(){

            },
            onExpandRow: function (index, row, $detail) {
                InitSubTable2(index, row, $detail);
            }
        });
    }
    function InitSubTable2 (index, row, $detail) {
        var fundMoneyType = row.fundMoneyType;
        cur_table = $detail.html('<table id="child_table2" class="table table-striped table-hover"></table>').find('table');
        $(cur_table).bootstrapTable({
            url: '/sea/finance/fundType/findByShopMoneyType',
            method: 'get',
            clickToSelect: true,
            queryParams: { fundMoneyType: fundMoneyType,fundShop:fundShop },
            ajaxOptions: { fundMoneyType: fundMoneyType,fundShop:fundShop },
            //height: 500,
            uniqueId: "id",
            pageSize: 10,
            pageList: [10, 25],
            detailView: false,
            columns: [
                {
                    field: 'fundShopName',
                    title: '店铺',
                    align: 'center'
                },{
                    field: 'fundTotal',
                    title: '余额',
                    align: 'center'
                }],
            onLoadSuccess : function(){

            }
        });
    }

</script>
</body>
</html>
